import { IsIn, IsNumber, IsOptional, IsString } from 'class-validator';

export class CreateInstrumentDto {
  @IsString({ message: 'name必须是字符串' })
  name: string;

  @IsString({ message: 'cover必须是字符串' })
  @IsOptional()
  cover: string;

  @IsString({ message: 'location必须是字符串' })
  location: string;

  @IsString({ message: 'manufacturer必须是字符串' })
  manufacturer: string;

  @IsString({ message: 'manu_at必须是字符串' })
  manu_at: string;

  @IsNumber({}, { message: 'model必须是数字' })
  manu_date: number;

  @IsString({ message: 'manu_no必须是字符串' })
  manu_no: string;

  @IsString({ message: 'ref_no必须是字符串' })
  @IsOptional()
  ref_no: string;

  @IsNumber({}, { message: 'purchased_date必须是数字' })
  purchased_date: number;

  @IsString({ message: 'specification必须是字符串' })
  @IsOptional()
  specification: string;

  @IsString({ message: 'features必须是字符串' })
  @IsOptional()
  features: string;

  @IsNumber()
  @IsIn([1, 2, 3])
  status: number;

  @IsNumber({}, { message: 'categoryId必须是数字' })
  categoryId: number;
}
